package edu.towson.cosc603.coffeemaker;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class InventoryTest {

	private Inventory i;
	@Before
	public void setUp() throws Exception {
		i = new Inventory();
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testInventory() {
		Inventory inv = new Inventory();
		assertNotNull(inv);
	}

	@Test
	public void testGetChocolate() {
		Inventory inv = new Inventory();
		inv.setChocolate(15);
		assertEquals(inv.getChocolate(),15);
	}

	@Test
	public void testSetChocolate() {
		i.setChocolate(20);
		assertEquals(i.getChocolate(),20);
	}

	@Test
	public void testSetChocolate2(){
		i.setChocolate(-2);
		assertEquals(i.getChocolate(),0);
	}
	@Test
	public void testGetCoffee() {
		i.setCoffee(5);
		assertEquals(i.getCoffee(),5);
	}

	@Test
	public void testSetCoffee() {
		i.setCoffee(-5);
		assertEquals(i.getCoffee(),0);
	}


	@Test
	public void testSetMilk() {
		i.setMilk(-3);
		assertEquals(i.getMilk(),0);
	}



	@Test
	public void testSetSugar() {
		i.setSugar(-22);
		assertEquals(i.getSugar(),0);
	}

	@Test
	public void testEnoughIngredients() {
		i.setMilk(20);
		i.setSugar(20);
		i.setChocolate(20);
		i.setCoffee(20);
		Recipe r1 = new Recipe();
		r1.setName("Coffee");
		r1.setPrice(50);
		r1.setAmtCoffee(6);
		r1.setAmtMilk(1);
		r1.setAmtSugar(1);
		r1.setAmtChocolate(0);
		
		assertTrue(i.enoughIngredients(r1));
		
	}

	@Test
	public void testToString() {
		i.setMilk(20);
		i.setSugar(20);
		i.setChocolate(20);
		i.setCoffee(20);
		assertEquals(i.toString(),"Coffee: " + i.getCoffee() + "\n" +
				"Milk: " + i.getMilk() + "\n" +
				"Sugar: " + i.getSugar() + "\n" +
				"Chocolate: " + i.getChocolate() + "\n");
	}

}
